package com.cloud.jwt;

public class JwtExample {
    public static void main(String[] args) {
        User user = new User();
        user.setDepartment("Engineering");
        user.setPhone("18811481664");
        user.setEmail("1234@163.com");
        Address address = new Address();
        address.setStreet("Beijing");
        address.setCity("Beijing");
        user.setAddress(address);
        JwtUtil jwtUtil = new JwtUtil();

        // 生成JWT
        String token = jwtUtil.generateToken(user);
        System.out.println("Generated JWT: " + token);


        // 解析JWT并提取信息
        User user1 = jwtUtil.parseToken(token);
        System.out.println(user1);

    }
}